using System;
using System.Linq;
using UnityEngine;
using QFramework;

namespace ProjectMyFarmAndShe
{
	public partial class ShopSellItemPanel : ViewController,IController
	{
		private void Awake()
		{
			SellItemTemplate.Hide();
		}

		private void OnEnable()
		{
			Content.DestroyChildren();
			
			foreach (var shopItem in this.GetSystem<IShopSystem>().ShopItems.Where(data => data.Type == ShopItemType.Sell))
			{
				SellItemTemplate.InstantiateWithParent(Content)
					.Self(self =>
					{
						self.Init(shopItem);
					})
					.Show();
			}
		}

		void Start()
		{
			// Code Here
		}

		public IArchitecture GetArchitecture()
		{
			return Global.Interface;
		}
	}
}
